package com.smzd.framework.utils.reflect;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class GenericHelper {
	public static final Class<?> getActuralClass(Class<?> clazz){
		if(clazz.getSimpleName().indexOf("$")>0){
			clazz = clazz.getSuperclass();
		}
		ParameterizedType klass = ((ParameterizedType) clazz
				.getGenericSuperclass());
		Type[] types = klass.getActualTypeArguments();
		if(types!=null&&types.length>0){
			return (Class<?>)types[0];
		}
		return null;
	}
	public static final Class<?>[] getActuralClasses(Class<?> clazz){
		ParameterizedType klass = ((ParameterizedType) clazz
				.getGenericSuperclass());
		Type[] types = klass.getActualTypeArguments();
		if(types!=null&&types.length>0){
			return (Class<?>[])types;
		}
		return null;
	}
}
